<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var r = 0;
        var a = 1;
        while (a <= 100) {
            r = r + a;
            a++;
        }
        alert("1到100的和为：" + r);
    </script>
</body>
</html>